package com.K_lificapp;

//import java.sql.Date;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class CursosSQLiteHelper extends SQLiteOpenHelper {
	public static final String TABLA_CURSOS = "Cursos";
	  public static final String IDCURSO = "IdCurso";
	  public static final String CURSO = "curso";
	  public static final String PLAN = "plan";
	  public static final String NOPERIODO = "noPeriodo";
	  public static final String MODALIDAD = "modalidad";
	  public static final String TURNO = "turno";
	  public static final String FECHAINICIO = "fechaInicio";

	  private static final String DATABASE_NOMBRE = "k-lificapp.db";
	  private static final int DATABASE_VERSION = 1;

	  // Database creation sql statement
	  private static final String DATABASE_CREATE = "create table "
	      + TABLA_CURSOS + "(" + IDCURSO + " integer primary key autoincrement, " + 
	      	CURSO + " text not null, " + 
	      	PLAN + " integer not null, " +
	      	NOPERIODO + " integer not null, " +
	      	MODALIDAD + " integer not null, " + 
	      	TURNO + " integer not null, " +
	      	FECHAINICIO + " date)";

	  public CursosSQLiteHelper(Context context) {
	    super(context, DATABASE_NOMBRE, null, DATABASE_VERSION);
	  }

	  @Override
	  public void onCreate(SQLiteDatabase database) {
	    database.execSQL(DATABASE_CREATE);
	  }

	  @Override
	  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	    Log.w(AlumnosSQLiteHelper.class.getName(),
	        "Upgrading database from version " + oldVersion + " to "
	            + newVersion + ", which will destroy all old data");
	    db.execSQL("DROP TABLE IF EXISTS " + TABLA_CURSOS);
	    onCreate(db);
	  }
}
